package com.jianneng.jdg.model.homeactivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.com.jianneng.jdg.R;

public class MyCodeActivity extends BaseActivity implements OnClickListener {
private LinearLayout mBack,mScreen;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_my_code);
		init();
	}
	private void init() {
		mBack = (LinearLayout) findViewById(R.id.person_code_back);
		mBack.setOnClickListener(this);
		mScreen = (LinearLayout) findViewById(R.id.screen);
		mScreen.setOnClickListener(this);
	}
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.person_code_back:
			finish();
			break;
		case R.id.screen:
			Intent openCameraIntent = new Intent(this,CaptureActivity.class);
			startActivityForResult(openCameraIntent, 0);
			break;
		default:
			break;
		}
		
	}
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
	
		if (resultCode == RESULT_OK) {
			Bundle bundle = data.getExtras();
			String scanResult = bundle.getString("result");
			System.out.println(scanResult+"qqqqqqqqqqqqq");
			Toast.makeText(getApplicationContext(), scanResult, 1).show();
		}
	}

}
